﻿using CID.Domain.Users;
using NHibernate;

namespace CID.Domain.Persistence.Tests.Users
{
    static class DataProvider
    {
        private static class UserConstants 
        {
            public const string Name = "name";
            public const string UserName = "user.name";
            public const string Email = "user.name@domain.com";
        }

        public static User CreateUser(string name = UserConstants.Name, string userName = UserConstants.UserName, string email = UserConstants.Email, params UserRole[] userRoles)
        {
            var user = new User(name, userName, email);
            foreach (UserRole userRole in userRoles)
                user.AssignRole(userRole);
            return user;
        }

        public static User GetUser(ISession session, IUser userData)
        {
            return session.Get<User>(userData.Id);
        }
    }
}
